home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1993 / MacHack 1993.toast / MacHack™ 1987-1992 / MacHack™ '90 / Source Code ƒ / Misc. Pascal ƒ / Jay's Cookie / Cookie.r < prev    next >
Encoding:
Text File  |  1989-02-08  |  2.4 KB  |  87 lines  |  [TEXT/MPS ]

  1. /*
  2.  * File Cookie.r
  3.  *
  4.  * Copyright Apple Computer, Inc. 1985-1987
  5.  * All rights reserved.
  6.  *
  7.  * Sample desk accessory resource file.
  8.  * This incorporates the DRVR header information (defined here)
  9.  * with the linked code (stored as a 'DRVW' resource in the link command)
  10.  */
  11.  
  12. #include "Types.r"                /* To get system types */
  13. #include "MPWTypes.r"            /* To get 'DRVW' type */
  14.  
  15. type 'DRVR' as 'DRVW';            /* Map 'DRVW' => 'DRVR' */
  16.  
  17. /*
  18.  * This will produce a DRVR resource from the special DRVW type.
  19.  *
  20.  * Note that the ID 12 is irrelevant, since the Font/DA Mover
  21.  * will renumber it to something else when installing it anyway.
  22.  *
  23.  * The leading NUL in the resource name is required to
  24.  * conform to the desk accessory naming convention.
  25.  *
  26.  * The resource is declared purgeable.    If the code were to
  27.  * do funky things like SetTrapAddress calls (requiring the code to
  28.  * be around at all times), we would have to set it nonpurgeable.
  29.  */
  30.  
  31. #define DriverID    12
  32.  
  33. resource 'DRVR' (DriverID, "\0x00Cookie", purgeable) {
  34.     /*
  35.      * DRVR flags
  36.      */
  37.     dontNeedLock,            /* OK to float around, not saving ProcPtrs */
  38.     dontNeedTime,            /* Yes, give us periodic Control calls */
  39.     needGoodbye,            /* No special requirements */
  40.     noStatusEnable,
  41.     ctlEnable,                /* Desk accessories only do Control calls */
  42.     noWriteEnable,
  43.     noReadEnable,
  44.     0,                        /* drvrDelay - Wake up every 5 seconds */
  45.     mDownMask + updateMask + keyDownMask + autoKeyMask,
  46.     0,                        /* drvrMenu - This DA has no menu */
  47.     "Cookie",                /* drvrName - This isn't used by the DA */
  48.     /*
  49.      * This directive inserts the contents of the DRVW resource
  50.      * produced by linking DRVRRuntime.o with our DA code
  51.      */
  52.     $$resource("Cookie.DRVW", 'DRVW', 0)
  53. };
  54.  
  55. /*
  56.  * Since desk accessories cannot use global data (and the C compiler
  57.  * considers string constants to be global data) and we really don't
  58.  * want to hard-code strings in our source, the strings used by the 
  59.  * DA are stored in the resource file. Note the expression used to
  60.  * figure out the resource id.
  61.  */
  62.  
  63. resource 'STR#' (0xC000 | (DriverID << 5), "Cookie's Strings") {
  64.     {
  65.         "Fortunes"
  66.     };
  67. };
  68.  
  69.  
  70. resource 'WIND' (0xC000 | (DriverID << 5), "Cookie's Window") {
  71.     {0, 0, 0, 0},
  72.     documentProc,
  73.     invisible,
  74.     goAway,
  75.     0x0,
  76.     "Fortune Cookie"
  77. };
  78.  
  79.  
  80. /* Type WhereAt, which puts the window where it should be */
  81. type 'WhAt' {
  82.         rect;            /* The position the window was last in */
  83. };
  84.  
  85. resource 'WhAt' (0xC000 | (DriverID << 5), "Cookie's WhereAt", purgeable) {
  86.     {100, 5, 238, 395}
  87. };